#ifndef INFINITY_CELL_CLUSTER_H
#	define INFINITY_CELL_CLUSTER_H

#include "graphics/renderer.h"
#include "graphics/indexbuffer.h"
#include "graphics/vertexbuffer.h"

#include "worldgridmanager.h"

#include "planet.h"
#include "planetcell.h"

#include "graphicsmodel.h"

namespace infinity {
	namespace render {

class CellCluster
{
public:
	typedef struct float3
	{
		float3(float x=0,float y=0, float z=0):x(x),y(y),z(z){};
		float x,y,z;
	}_vertex,_normal,_color;

	typedef struct int4
	{
		int4(int x,int y, int z, int w):x(x),y(y),z(z),w(w){};

		union
		{
			struct  
			{
				short x,y,z,w;
			};
			short data[4];

		};

		short get(unsigned int i)
		{
			return data[i];
		}
	}_indices;

public : //! @name Construction & Destruction
	//! @{
	CellCluster(dw::uint32 size = 16, Vector3i origin = Vector3i(0,0,0));
	virtual ~CellCluster();
	//! @}

public : //! @name Commands
	//! @{
	virtual void initializeMesh() = 0;
	virtual graphics::Model* getModel() { return m_model; }
	virtual const dw::maths::ivec3& getOrigin() const { return m_origin; }
	//!@}

protected : // @name Data
	//! @{
	dw::uint32 m_size;
	dw::uint32 curindex;
	dw::uint32 curvertex;
	graphics::Model* m_model;
	dw::maths::ivec3 m_origin;
	dw::float32* m_vertices;
	dw::uint16* m_indices;
	//! @}
};

	} // namespace render
} // namespace infinity

#endif // !INFINITY_CELL_CLUSTER_H
